package com.sna.snaapplication.mapper;


import com.github.yulichang.base.MPJBaseMapper;
import com.sna.snaapplication.entity.usercore.Role;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;


@Mapper
public interface RoleMapper extends MPJBaseMapper<Role> {

    @Select("SELECT role_id FROM role WHERE role_key = #{roleName}")
    Long FindId(String roleName);


    @Select("SELECT * FROM role r " +
            "JOIN user_role ur ON r.role_id = ur.role_id " +
            "JOIN user u ON ur.user_id = u.user_id " +
            "WHERE u.user_id= #{userId}")
    Role FindByUserId(Long userId);
}
